<?php

Route::get('icons')->uses('DevelopController@showIcons')->name('b_Dev_showIcons');

Route::prefix('config')->group(function (){
    Route::get('index')->uses('ConfigController@index')->name('b_Config_index');

    Route::get('add')->uses('ConfigController@showAddForm')->name('b_Config_showAddForm');
    Route::post('save')->uses('ConfigController@save')->name('b_Config_save');

    Route::get('{name}/edit')->uses('ConfigController@showEditForm')->name('b_Config_showEditForm')
        ->where('name','^[A-Za-z][a-zA-Z0-9_]*');

    Route::post('{name}/update')->uses('ConfigController@update')->name('b_Config_update')
        ->where('name','^[A-Za-z][a-zA-Z0-9_]*');

    Route::match(['get','post'],'{name}/delete')->uses('ConfigController@delete')->name('b_Config_delete')
        ->where('name','^[A-Za-z][a-zA-Z0-9_]*');

    Route::match(['get','post'],'{name}/switch')->uses('ConfigController@switchConfig')->name('b_Config_switchConfig')
        ->where('name','^[A-Za-z][a-zA-Z0-9_]*');

    Route::match(['get','post'],'batch_delete')->uses('ConfigController@batchDelete')->name('b_Config_batchDelete');

});

Route::prefix('actions')->group(function (){
    Route::get('list')->uses('ActionsController@showActions')->name('b_Auth_showActions');

    Route::get('add')->uses('ActionsController@addActionForm')->name('b_Auth_addActionForm');
    Route::post('save')->uses('ActionsController@saveAction')->name('b_Auth_saveAction');

    Route::match(['post','get'],'edit/{action_id}')->uses('ActionsController@editAction')->name('d_Action_editAction')
            ->where('action_id','[0-9]+');

    Route::match(['post','get'],'remove/{action_id}')->uses('ActionsController@delete')->name('d_Action_delete')
        ->where('action_id','[0-9]+');
});

Route::prefix('currency')->group(function (){
    Route::get('/')->uses('CurrencyController@currencies')->name('d_Currency_currencies');

    Route::match(['get','post'],'add')->uses('CurrencyController@create')->name('d_Currency_create');

    Route::match(['post','get'],'edit/{id}')->uses('CurrencyController@update')->name('d_Currency_update')
        ->where('id','[0-9]+');

    Route::match(['post','get'],'remove/{id}')->uses('CurrencyController@delete')->name('d_Currency_delete')
        ->where('id','[0-9]+');

    Route::get('switch/{id}')->uses('CurrencyController@onOff')->name('d_Currency_onOff')
        ->where('id','[0-9]+');
});

Route::prefix('change')->group(function (){
    Route::get('/')->uses('ChangeTypeController@changes')->name('d_ChangeType_changes');

    Route::match(['get','post'],'add')->uses('ChangeTypeController@create')->name('d_ChangeType_create');

    Route::match(['post','get'],'edit/{id}')->uses('ChangeTypeController@update')->name('d_ChangeType_update')
        ->where('id','[0-9]+');

    Route::match(['post','get'],'remove')->uses('ChangeTypeController@delete')->name('d_ChangeType_delete');

    Route::get('switch/{id}')->uses('ChangeTypeController@switchType')->name('d_ChangeType_switchType')
        ->where('id','[0-9]+');
});

Route::prefix('advert')->group(function (){
    Route::get('/')->uses('AdPosController@index')->name('d_AdPos_index');
    Route::match(['get','post'],'add')->uses('AdPosController@create')->name('d_AdPos_create');

    Route::match(['get','post'],'edit/{id}')->uses('AdPosController@update')->name('d_AdPos_update')
        ->where('id','[0-9]+');

    Route::get('switch/{id}')->uses('AdPosController@switchAdPos')->name('d_AdPos_switchAdPos')
        ->where('id','[0-9]+');

    Route::match(['post','get'],'remove')->uses('AdPosController@delete')->name('d_AdPos_delete');
});
